home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / sviluppo / svilupp2 / gmsppr10.lha / MakeFiles.c < prev    next >
C/C++ Source or Header  |  1996-09-22  |  16KB  |  632 lines

  1. #ifndef DOS_STDIO_H
  2. #include <dos/stdio.h>
  3. #endif
  4.  
  5. #include <MyLib.h>
  6.  
  7. /************************************************************************/
  8.  
  9. struct Function
  10. {
  11.   const char *Name;
  12.   const char *Params;
  13. };
  14.  
  15. static struct Function Functions[]=
  16. {
  17.   {"GS_MemoryAlloc","RESULT \"void **\" Memory D0 ULONG Size\n"},
  18.   {"GS_MemoryFree", "A0 \"void **\" Memory\n"},
  19.   {"GS_MemoryRealloc", "RESULT \"void **\" Memory A0 \"void **\" OldMemory D0 ULONG NewSize\n"},
  20.   {"GS_AllocateColors", "RESULT ULONG Success A0 \"struct Screen **\" Screen A1 \"struct GS_ColorDef **\" Colors D0 ULONG Distinct\n"},
  21.   {"GS_FreeColors", "A0 \"struct Screen **\" Screen A1 \"struct GS_ColorDef **\" Colors\n"},
  22.   {"GS_FormatString", "RESULT \"char **\" String A0 \"const char **\" Template A1 \"const void **\" Parameters A2 \"ULONG **\" Length A3 \"struct Locale **\" Locale\n"},
  23.   {"GS_FormatDate", "RESULT \"char **\" String A0 \"const char **\" Template D0 ULONG TimeStamp A1 \"ULONG **\" Length A2 \"struct Locale **\" Locale\n"},
  24.   {"GS_DrawString", "A0 \"const char **\" Template A1 \"void **\" Parameters A2 \"struct RastPort **\" RastPort A3 \"struct Locale **\" Locale\n"},
  25.   {"GS_DrawDate", "A0 \"char **\" Template D0 ULONG TimeStamp A1 \"struct RastPort **\" RastPort A2 \"struct Locale **\" Locale\n"},
  26.   {"GS_StringWidth", "RESULT WORD Width A0 \"const char **\" Template A1 \"void **\" Parameters A2 \"struct RastPort **\" RastPort A3 \"struct Locale **\" Locale\n"},
  27.   {"GS_DateWidth", "RESULT WORD Width A0 \"char **\" Template D0 ULONG TimeStamp A1 \"struct RastPort **\" RastPort A2 \"struct Locale **\" Locale\n"},
  28.   {"GS_LoadSprites", "RESULT \"struct GS_Sprites **\" Sprites A0 \"const char **\" GameName A1 \"struct Screen **\" Screen\n"},
  29.   {"GS_FreeSprites", "A0 \"struct GS_Sprites **\" Sprites A1 \"struct Screen **\" Screen\n"},
  30.   {"GS_AllocateJoystick", "RESULT ULONG Success A0 \"struct MsgPort **\" ReplyPort D0 UBYTE ControllerType\n"},
  31.   {"GS_SendJoystick", "\n"},
  32.   {"GS_FreeJoystick", "\n"},
  33.   {"GS_HappyBlanker", "RESULT ULONG Success\n"},
  34.   {"GS_NoHappyBlanker", "\n"},
  35.   {"GS_ObtainScoreHandle", "RESULT \"void **\" ScoreHandle A0 \"const struct GS_ScoreDef **\" ScoreDef A1 \"const char **\" SubPath A2 \"const char **\" UserName\n"},
  36.   {"GS_ReleaseScoreHandle", "A0 \"void **\" ScoreHandle\n"},
  37.   {"GS_ObtainScores", "RESULT \"struct GS_ScoreList **\" Scores A0 \"void **\" ScoreHandle D0 ULONG ScoreType\n"},
  38.   {"GS_InsertScore", "RESULT LONG Error A0 \"void **\" ScoreHandle A1 \"struct GS_Score **\" Score\n"},
  39.   {"GS_ReleaseScores", "A0 \"void **\" ScoreHandle A1 \"struct GS_ScoreList **\" Scores\n"},
  40.   {"GS_WindowSleep", "RESULT ULONG Success A0 \"struct Window **\" Window\n"},
  41.   {"GS_WindowWakeup", "A0 \"struct Window **\" Window\n"},
  42.   {"GS_HappyBlanker", "RESULT ULONG Success\n"},
  43.   {"GS_NoHappyBlanker", "\n"},
  44.   {"GS_TransformUsername", "RESULT \"char **\" Filename A0 \"const char **\" Username A1 \"char **\" OldFilename\n"}
  45. };
  46.  
  47. /************************************************************************/
  48.  
  49. struct DosLibrary *DOSBase;
  50.  
  51. static BPTR Filehandle;
  52. static const char *Filename;
  53.  
  54. static struct RDArgs *RDArgs;
  55. static struct
  56. {
  57.   LONG FD;
  58.   LONG Pragma;
  59.   LONG Clib;
  60.   LONG C;
  61.   LONG H;
  62. } Arguments;
  63.  
  64. /************************************************************************/
  65.  
  66. static void CloseAll(int, LONG, const char *) NORETURN;
  67.  
  68. static void CloseAll(int RC, LONG Error, const char *String)
  69.  
  70. {
  71.   if (Filehandle!=MKBADDR(NULL))
  72.     {
  73.       if (!Close(Filehandle))
  74.     {
  75.       if (Error==0)
  76.         {
  77.           Error=IoErr();
  78.           String=Filename;
  79.         }
  80.     }
  81.       DeleteFile((char *)Filename);
  82.     }
  83.   if (Error!=0)
  84.     {
  85.       PError(Error,String);
  86.     }
  87.   CloseStdErr();
  88.   FreeArgs(RDArgs);
  89.   CloseLibrary(&DOSBase->dl_lib);
  90.   MyExit(RC,Error);
  91. }
  92.  
  93. /************************************************************************/
  94.  
  95. static INLINE void Init(void)
  96.  
  97. {
  98.   if ((DOSBase=(struct DosLibrary *)OpenLibrary("dos.library",ROM_VERSION))==NULL)
  99.     {
  100.       MyExit(RETURN_CATASTROPHY,0);
  101.     }
  102.   if ((RDArgs=ReadArgs("FD/S,PRAGMA/S,CLIB/S,C/S,H/S",(LONG *)&Arguments,NULL))==NULL)
  103.     {
  104.       CloseAll(RETURN_FAIL,IoErr(),NULL);
  105.     }
  106. }
  107.  
  108. /************************************************************************/
  109. /*                                    */
  110. /* Get data about specific register.                    */
  111. /* Register -1 designates the RESULT.                    */
  112. /* Types:                                */
  113. /*  0 -> type                                */
  114. /*  1 -> name                                */
  115. /*                                    */
  116. /************************************************************************/
  117.  
  118. static char *GetRegisterData(const char *Params, int Register, int Type)
  119.  
  120. {
  121.   static char Buffer[100];
  122.  
  123.   struct CSource CSource;
  124.   int State;
  125.   int Found;
  126.   LONG Item;
  127.  
  128.   CSource.CS_Buffer=Params;
  129.   CSource.CS_Length=strlen(Params);
  130.   CSource.CS_CurChr=0;
  131.   State=0;
  132.   Found=FALSE;
  133.   while ((Item=ReadItem(Buffer,sizeof(Buffer),&CSource))!=ITEM_NOTHING)
  134.     {
  135.       switch (Item)
  136.     {
  137.     case ITEM_ERROR:
  138.       CloseAll(RETURN_ERROR,IoErr(),"Christine");
  139.  
  140.     case ITEM_QUOTED:
  141.     case ITEM_UNQUOTED:
  142.       switch (State)
  143.         {
  144.         case 0:
  145.           if (strcmp("RESULT",Buffer)==0)
  146.         {
  147.           if (Register==-1)
  148.             {
  149.               Found=TRUE;
  150.             }
  151.         }
  152.           else
  153.         {
  154.           if (Register==(Buffer[0]=='D' ? 0 : 8)+(Buffer[1]-'0'))
  155.             {
  156.               Found=TRUE;
  157.             }
  158.         }
  159.           break;
  160.  
  161.         case 1:
  162.           if (Found && Type==0)
  163.         {
  164.           return Buffer;
  165.         }
  166.           break;
  167.  
  168.         case 2:
  169.           if (Found && Type==1)
  170.         {
  171.           return Buffer;
  172.         }
  173.           break;
  174.         }
  175.       break;
  176.     }
  177.       State=(State+1)%3;
  178.     }
  179.   if (Register==-1 && Type==0)
  180.     {
  181.       return "void";
  182.     }
  183.   return NULL;
  184. }
  185.  
  186. /************************************************************************/
  187.  
  188. static INLINE void MakeFD(void)
  189.  
  190. {
  191.   if (Arguments.FD)
  192.     {
  193.       ULONG Result;
  194.       int i;
  195.  
  196.       Filename="GameSupport_lib.fd";
  197.       if ((Filehandle=Open(Filename,MODE_NEWFILE))==MKBADDR(NULL))
  198.     {
  199.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  200.     }
  201.       if (FPuts(Filehandle,"##base _GameSupportBase\n##bias 30\n##public\n")!=0)
  202.     {
  203.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  204.     }
  205.       for (i=0; i<ARRAYSIZE(Functions); i++)
  206.     {
  207.       struct CSource CSource;
  208.       LONG Item;
  209.       int Type;
  210.       int First;
  211.       int Result;
  212.       char Buffer[100];
  213.  
  214.       if (VFPrintf(Filehandle,"%s(",&Functions[i].Name)==-1)
  215.         {
  216.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  217.         }
  218.       CSource.CS_Buffer=(char *)Functions[i].Params;
  219.       CSource.CS_Length=strlen(Functions[i].Params);
  220.       CSource.CS_CurChr=0;
  221.       Type=0;
  222.       First=TRUE;
  223.       while ((Item=ReadItem(Buffer,sizeof(Buffer),&CSource))!=ITEM_NOTHING)
  224.         {
  225.           switch (Item)
  226.         {
  227.         case ITEM_ERROR:
  228.           CloseAll(RETURN_ERROR,IoErr(),"Christine");
  229.  
  230.         case ITEM_QUOTED:
  231.         case ITEM_UNQUOTED:
  232.           if (Type==0)
  233.             {
  234.               Result=(strcmp("RESULT",Buffer)==0);
  235.             }
  236.           else if (Type==2)
  237.             {
  238.               if (!Result)
  239.             {
  240.               if (FPrintf(Filehandle,(First ? "%s" : ",%s"),Buffer)==-1)
  241.                 {
  242.                   CloseAll(RETURN_ERROR,IoErr(),Filename);
  243.                 }
  244.               First=FALSE;
  245.             }
  246.             }
  247.           break;
  248.         }
  249.           Type=(Type+1)%3;
  250.         }
  251.       if (FPuts(Filehandle,")(")!=0)
  252.         {
  253.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  254.         }
  255.       CSource.CS_Buffer=(char *)Functions[i].Params;
  256.       CSource.CS_Length=strlen(Functions[i].Params);
  257.       CSource.CS_CurChr=0;
  258.       Type=0;
  259.       First=TRUE;
  260.       while ((Item=ReadItem(Buffer,sizeof(Buffer),&CSource))!=ITEM_NOTHING)
  261.         {
  262.           switch (Item)
  263.         {
  264.         case ITEM_ERROR:
  265.           CloseAll(RETURN_ERROR,IoErr(),"Christine");
  266.  
  267.         case ITEM_QUOTED:
  268.         case ITEM_UNQUOTED:
  269.           if (Type==0)
  270.             {
  271.               Result=(strcmp("RESULT",Buffer)==0);
  272.               if (!Result)
  273.             {
  274.               if (FPrintf(Filehandle,(First ? "%s" : "/%s"),Buffer)==-1)
  275.                 {
  276.                   CloseAll(RETURN_ERROR,IoErr(),Filename);
  277.                 }
  278.               First=FALSE;
  279.             }
  280.             }
  281.           break;
  282.         }
  283.           Type=(Type+1)%3;
  284.         }
  285.       if (FPuts(Filehandle,")\n")!=0)
  286.         {
  287.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  288.         }
  289.     }
  290.       if (FPuts(Filehandle,"##end\n")!=0)
  291.     {
  292.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  293.     }
  294.       Result=Close(Filehandle);
  295.       Filehandle=NULL;
  296.       if (!Result)
  297.     {
  298.       LONG Error;
  299.  
  300.       Error=IoErr();
  301.       DeleteFile(Filename);
  302.       CloseAll(RETURN_ERROR,Error,Filename);
  303.     }
  304.       SetProtection(Filename,FIBF_EXECUTE);
  305.     }
  306. }
  307.  
  308. /************************************************************************/
  309.  
  310. static INLINE void MakePragma(void)
  311.  
  312. {
  313.   if (Arguments.Pragma)
  314.     {
  315.       ULONG Result;
  316.       int i;
  317.       ULONG Offset;
  318.  
  319.       Filename="include/pragmas/GameSupport_pragmas.h";
  320.       if ((Filehandle=Open(Filename,MODE_NEWFILE))==MKBADDR(NULL))
  321.     {
  322.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  323.     }
  324.       if (FPuts(Filehandle,"#ifndef PRAGMA_GAMESUPPORT_PRAGMAS_H\n#define PRAGMA_GAMESUPPORT_PRAGMAS_H\n\n")!=0)
  325.     {
  326.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  327.     }
  328.       for (Offset=30, i=0; i<ARRAYSIZE(Functions); i++, Offset+=6)
  329.     {
  330.       struct CSource CSource;
  331.       LONG Item;
  332.       int Type;
  333.       int ParamCount;
  334.       char Buffer[100];
  335.       char Registers[16];
  336.       int RegIndex;
  337.  
  338.       if (FPrintf(Filehandle,"#pragma libcall GameSupportBase %s %lx ",Functions[i].Name,Offset)==-1)
  339.         {
  340.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  341.         }
  342.       CSource.CS_Buffer=(char *)Functions[i].Params;
  343.       CSource.CS_Length=strlen(Functions[i].Params);
  344.       CSource.CS_CurChr=0;
  345.       Type=0;
  346.       ParamCount=0;
  347.       RegIndex=sizeof(Registers)-1;
  348.       Registers[RegIndex]='\0';
  349.       while ((Item=ReadItem(Buffer,sizeof(Buffer),&CSource))!=ITEM_NOTHING)
  350.         {
  351.           switch (Item)
  352.         {
  353.         case ITEM_ERROR:
  354.           CloseAll(RETURN_ERROR,IoErr(),"Christine");
  355.  
  356.         case ITEM_QUOTED:
  357.         case ITEM_UNQUOTED:
  358.           if (Type==0)
  359.             {
  360.               if (strcmp("RESULT",Buffer)!=0)
  361.             {
  362.               ULONG Register;
  363.  
  364.               Register=(Buffer[0]=='A') ? 8 : 0;
  365.               Register=Register+(Buffer[1]-'0');
  366.               Registers[--RegIndex]=(Register<10 ? '0' : ('A'-10))+Register;
  367.               ParamCount++;
  368.             }
  369.             }
  370.           break;
  371.         }
  372.           Type=(Type+1)%3;
  373.         }
  374.       if (FPrintf(Filehandle,"%s0%lx\n",&Registers[RegIndex],ParamCount)==-1)
  375.         {
  376.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  377.         }
  378.     }
  379.       if (FPuts(Filehandle,"\n#endif  /* PRAGMA_GAMESUPPORT_PRAGMAS_H */\n")!=0)
  380.     {
  381.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  382.     }
  383.       Result=Close(Filehandle);
  384.       Filehandle=NULL;
  385.       if (!Result)
  386.     {
  387.       LONG Error;
  388.  
  389.       Error=IoErr();
  390.       DeleteFile(Filename);
  391.       CloseAll(RETURN_ERROR,Error,Filename);
  392.     }
  393.       SetProtection(Filename,FIBF_EXECUTE);
  394.     }
  395. }
  396.  
  397. /************************************************************************/
  398.  
  399. static INLINE void MakeClib(void)
  400.  
  401. {
  402.   if (Arguments.Clib)
  403.     {
  404.       ULONG Result;
  405.       int i;
  406.  
  407.       Filename="include/clib/GameSupport_protos.h";
  408.       if ((Filehandle=Open(Filename,MODE_NEWFILE))==MKBADDR(NULL))
  409.     {
  410.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  411.     }
  412.       if (FPuts(Filehandle,"#ifndef CLIB_GAMESUPPORT_PROTOS_H\n#define CLIB_GAMESUPPORT_PROTOS_H\n\n")!=0)
  413.     {
  414.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  415.     }
  416.       for (i=0; i<ARRAYSIZE(Functions); i++)
  417.     {
  418.       struct CSource CSource;
  419.       LONG Item;
  420.       int Type;
  421.       int First;
  422.       int Result;
  423.       char Buffer[100];
  424.  
  425.       if (FPrintf(Filehandle,"%s %s(",GetRegisterData(Functions[i].Params,-1,0),Functions[i].Name)==-1)
  426.         {
  427.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  428.         }
  429.       CSource.CS_Buffer=(char *)Functions[i].Params;
  430.       CSource.CS_Length=strlen(Functions[i].Params);
  431.       CSource.CS_CurChr=0;
  432.       Type=0;
  433.       First=TRUE;
  434.       while ((Item=ReadItem(Buffer,sizeof(Buffer),&CSource))!=ITEM_NOTHING)
  435.         {
  436.           switch (Item)
  437.         {
  438.         case ITEM_ERROR:
  439.           CloseAll(RETURN_ERROR,IoErr(),"Christine");
  440.  
  441.         case ITEM_QUOTED:
  442.         case ITEM_UNQUOTED:
  443.           if (Type==0)
  444.             {
  445.               Result=(strcmp("RESULT",Buffer)==0);
  446.             }
  447.           else if (Type==1)
  448.             {
  449.               if (!Result)
  450.             {
  451.               if (FPrintf(Filehandle,(First ? "%s" : ",%s"),Buffer)==-1)
  452.                 {
  453.                   CloseAll(RETURN_ERROR,IoErr(),Filename);
  454.                 }
  455.               First=FALSE;
  456.             }
  457.             }
  458.           break;
  459.         }
  460.           Type=(Type+1)%3;
  461.         }
  462.       if (FPuts(Filehandle,(First ? "void);\n" : ");\n"))!=0)
  463.         {
  464.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  465.         }
  466.     }
  467.       if (FPuts(Filehandle,"\n#endif  /* CLIB_GAMESUPPORT_PROTOS_H */\n")!=0)
  468.     {
  469.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  470.     }
  471.       Result=Close(Filehandle);
  472.       Filehandle=NULL;
  473.       if (!Result)
  474.     {
  475.       LONG Error;
  476.  
  477.       Error=IoErr();
  478.       DeleteFile(Filename);
  479.       CloseAll(RETURN_ERROR,Error,Filename);
  480.     }
  481.       SetProtection(Filename,FIBF_EXECUTE);
  482.     }
  483. }
  484.  
  485. /************************************************************************/
  486.  
  487. static INLINE void MakeH(void)
  488.  
  489. {
  490.   if (Arguments.H)
  491.     {
  492.       ULONG Result;
  493.       int i;
  494.  
  495.       Filename="protos.h";
  496.       if ((Filehandle=Open(Filename,MODE_NEWFILE))==MKBADDR(NULL))
  497.     {
  498.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  499.     }
  500.       if (FPuts(Filehandle,"#ifndef PROTOS_H\n#define PROTOS_H\n\n")!=0)
  501.     {
  502.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  503.     }
  504.       for (i=0; i<ARRAYSIZE(Functions); i++)
  505.     {
  506.       ULONG Registers;
  507.       LONG Register;
  508.  
  509.       if (FPuts(Filehandle,"SAVEDS")<0)
  510.         {
  511.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  512.         }
  513.       Registers=0;
  514.       for (Register=0; Register<16; Register++)
  515.         {
  516.           if (GetRegisterData(Functions[i].Params,Register,0)!=NULL)
  517.         {
  518.           Registers|=(1<<Register);
  519.         }
  520.         }
  521.       if (Registers!=0)
  522.         {
  523.           if (FPuts(Filehandle,"_ASM_")<0)
  524.         {
  525.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  526.         }
  527.           for (Register=0; Register<16; Register++)
  528.         {
  529.           if ((Registers&(1<<Register)) &&
  530.               (FPutC(Filehandle,Register<8 ? 'D' : 'A')==EOF ||
  531.                FPutC(Filehandle,'0'+(Register&7))==EOF))
  532.             {
  533.               CloseAll(RETURN_ERROR,IoErr(),Filename);
  534.             }
  535.         }
  536.         }
  537.       if (FPuts(Filehandle,"_PROTO(")<0)
  538.         {
  539.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  540.         }
  541.       for (Register=-1; Register<16; Register++)
  542.         {
  543.           const char *String;
  544.  
  545.           if ((String=GetRegisterData(Functions[i].Params,Register,0))!=NULL)
  546.         {
  547.           if (VFPrintf(Filehandle,(Register==-1 ? "%s" : ",%s"),&String)==-1)
  548.             {
  549.               CloseAll(RETURN_ERROR,IoErr(),Filename);
  550.             }
  551.           if (Register==-1)
  552.             {
  553.               if (VFPrintf(Filehandle,",Lib%s",&Functions[i].Name)==-1)
  554.             {
  555.               CloseAll(RETURN_ERROR,IoErr(),Filename);
  556.             }
  557.             }
  558.         }
  559.         }
  560.       if (FPuts(Filehandle,");\n")<0)
  561.         {
  562.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  563.         }
  564.     }
  565.       if (FPuts(Filehandle,"\n#endif  /* PROTOS_H */\n")!=0)
  566.     {
  567.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  568.     }
  569.       Result=Close(Filehandle);
  570.       Filehandle=NULL;
  571.       if (!Result)
  572.     {
  573.       LONG Error;
  574.  
  575.       Error=IoErr();
  576.       DeleteFile(Filename);
  577.       CloseAll(RETURN_ERROR,Error,Filename);
  578.     }
  579.       SetProtection(Filename,FIBF_EXECUTE);
  580.     }
  581. }
  582.  
  583. /************************************************************************/
  584.  
  585. static INLINE void MakeC(void)
  586.  
  587. {
  588.   if (Arguments.C)
  589.     {
  590.       ULONG Result;
  591.       int i;
  592.  
  593.       Filename="FunctionTable.c";
  594.       if ((Filehandle=Open(Filename,MODE_NEWFILE))==MKBADDR(NULL))
  595.     {
  596.       CloseAll(RETURN_ERROR,IoErr(),Filename);
  597.     }
  598.       for (i=0; i<ARRAYSIZE(Functions); i++)
  599.     {
  600.       if (VFPrintf(Filehandle,"(APTR)Lib%s,\n",&Functions[i].Name)==-1)
  601.         {
  602.           CloseAll(RETURN_ERROR,IoErr(),Filename);
  603.         }
  604.     }
  605.       Result=Close(Filehandle);
  606.       Filehandle=NULL;
  607.       if (!Result)
  608.     {
  609.       LONG Error;
  610.  
  611.       Error=IoErr();
  612.       DeleteFile(Filename);
  613.       CloseAll(RETURN_ERROR,Error,Filename);
  614.     }
  615.       SetProtection(Filename,FIBF_EXECUTE);
  616.     }
  617. }
  618.  
  619. /************************************************************************/
  620.  
  621. void AmigaMain(void)
  622.  
  623. {
  624.   Init();
  625.   MakeFD();
  626.   MakePragma();
  627.   MakeClib();
  628.   MakeC();
  629.   MakeH();
  630.   CloseAll(RETURN_OK,0,NULL);
  631. }
  632.